package com.whmall.service.crm.module.companycontact.impl;

import com.whmall.component.common.ObjectConverter;
import com.whmall.service.crm.entity.dto.companycontact.CreateOrUpdateCompanyContactReqDTO;
import com.whmall.service.crm.module.companycontact.entity.CompanyContactDO;
import org.springframework.stereotype.Component;

/**
 * CreateOrUpdateCompanyContactReqDTO -> CompanyContactDO转换器
 *
 * @author alex
 * @since 2020/8/5
 */
@Component
public class CoU2CompanyContactConverter
        implements ObjectConverter<CreateOrUpdateCompanyContactReqDTO, CompanyContactDO> {
    @Override
    public CompanyContactDO fillProperties(CreateOrUpdateCompanyContactReqDTO source, CompanyContactDO dest) {
        if (null == dest) {
            dest = new CompanyContactDO();
        }

        dest.setName(source.getName());
        dest.setEmail(source.getEmail());
        dest.setPosition(source.getPosition());
        dest.setTel(source.getTel());
        dest.setMobile(source.getMobile());
        dest.setFax(source.getFax());
        dest.setQq(source.getQq());
        dest.setGender(source.getGender());

        return dest;
    }
}
